package sxe.core.math;

import snobject.snDouble;
import snobject.snObject;
import snobject.snObjectArgList;
import step.FunctionWrapper;
import step.EvaluationFailure;

/**
 * Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
 * The conversion from degrees to radians is generally inexact.
 * @param argv must contain an snDouble object at top of the stack representing an angle in degrees
 * @return returns the measurement of the angle in radians
 */

public class toRadians extends FunctionWrapper{
	
	public snObject Call(snObjectArgList argv) throws EvaluationFailure{
		// REQUIRES: argv must contain an snDouble object at top of the stack representing an angle in radians
		// EFFECTS: returns the snDouble of the measurement of the angle in radians of the value from argv
		double ret = argv.popDouble().getDbl();
		
		return new snDouble(Math.toRadians(ret));
	}
}